<?php
class Gyujto extends AppModel {

	var $name = 'Gyujto';

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $belongsTo = array(
			'Gyujtotipus' => array('className' => 'Gyujtotipus',
								'foreignKey' => 'gyujtotipus_id',
								'conditions' => '',
								'fields' => '',
								'order' => ''
			)
	);

	var $hasMany = array(
			'Szamla' => array('className' => 'Szamla',
								'foreignKey' => 'ceg_id',
								'dependent' => false,
								'conditions' => '',
								'fields' => '',
								'order' => '',
								'limit' => '',
								'offset' => '',
								'exclusive' => '',
								'finderQuery' => '',
								'counterQuery' => ''
			)
	);

	var $hasAndBelongsToMany = array(
			'Osztaly' => array('className' => 'Osztaly',
						'joinTable' => 'gyujtok_osztalyok',
						'foreignKey' => 'gyujto_id',
						'associationForeignKey' => 'osztaly_id',
						'unique' => true,
						'conditions' => '',
						'fields' => '',
						'order' => '',
						'limit' => '',
						'offset' => '',
						'finderQuery' => '',
						'deleteQuery' => '',
						'insertQuery' => ''
			),
			'Tetel' => array('className' => 'Tetel',
						'joinTable' => 'gyujtok_tetelek',
						'foreignKey' => 'gyujto_id',
						'associationForeignKey' => 'tetel_id',
						'unique' => true,
						'conditions' => '',
						'fields' => '',
						'order' => '',
						'limit' => '',
						'offset' => '',
						'finderQuery' => '',
						'deleteQuery' => '',
						'insertQuery' => ''
			)
	);

	function getIdByNev($gyujtoNev){
		$gy = $this->find('first', array(
											'fields' => 'id',
											'conditions' => array('Gyujto.nev' => $gyujtoNev),
											'recursive' => -1));
		return $gy['Gyujto']['id'];
	}
}
?>